/*
 * \brief  Cap_session interface
 * \author Norman Feske
 * \date   2006-06-23
 *
 * A 'Cap_session' is an allocator of user-level capabilities.
 * User-level capabilities are used to reference server objects
 * across address spaces.
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__CAP_SESSION__CAP_SESSION_H_
#define _INCLUDE__CAP_SESSION__CAP_SESSION_H_

#include <base/capability.h>

namespace Genode {

	class Cap_session
	{
		protected:

			enum Opcode { ALLOC, FREE };

		public:

			static const char *service_name() { return "CAP"; }

			virtual ~Cap_session() { }

			/**
			 * Allocate new unique userland capability
			 *
			 * \param ep  entry point that will use this capability
			 *
			 * \return new userland capability
			 */
			virtual Capability alloc(Capability ep) = 0;

			/**
			 * Free userland capability
			 *
			 * \param cap  userland capability to free
			 */
			virtual void free(Capability cap) = 0;
	};
}

#endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */
